<?php 
class generalFunctions{
	function xuatds($mang,$ten,$nameall)
	{
		$kq="<select style='width:270px;height:24px;font-size:12px;padding-bottom:3px;' name='".$ten."' id='".$ten."'>";
			$kq.="<optgroup ><option value='ALL'>".$nameall."</option></optgroup>";
			foreach ($mang as $khoa=>$giatri)
			{
				$kq.="<optgroup label='".$khoa."'>";
					foreach ($giatri as $hienthi)
					{
						$kq.="<option value='".$hienthi[0]."'";
						if ($_REQUEST["$ten"]==$hienthi[0])
							 $kq.="selected='selected' >".$hienthi[1]."</option>";
						else
							$kq.="'>".$hienthi[1]."</option>";
					}
				$kq.="</optgroup>";
			}
		$kq.="</select>";
		return $kq;
	}
	
	function loadContent7($l_vacationform,$l_content,$l_branch,$l_office,$l_LocationLeave,$l_name,$l_TypeLeave,$l_time,$l_Reason){
		$kq ='<table width="100%" border="1" cellspacing="0">
			<tr height="80px">
				<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_content.'</td>
				<td colspan="3" style="font-size:20px;text-align: center;font-weight: bold;" ><input value="'.$l_vacationform.'" readonly="readonly" style="font-weight: bold;width: 100%;height: 100%;font-size: 20px;text-align: center;border: none" width="100%" height="100%"></td>
			</tr>
			<tr height="50px">
				<td width="10%" align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_branch.'</td>
				<td width="40%" style="text-align: left;padding-left: 5px;">&nbsp;</td>
				<td width="10%" align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_office.'</td>
				<td width="40%"  style="text-align: left;padding-left: 5px;">&nbsp;</td>
			</tr>
			<tr height="50px">
				<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_LocationLeave.'</td>
				<td style="text-align: left;padding-left: 5px;">&nbsp;</td>
				<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_name.'</td>
				<td style="text-align: left;padding-left: 5px;">&nbsp;</td>
			</tr>
			<tr height="50px">
				<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_TypeLeave.'</td>
				<td colspan="3" style="text-align: left;padding-left: 5px;">&nbsp;</td>
			</tr>
			<tr height="50px">
				<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_time.'</td>
				<td colspan="3" style="text-align: left;padding-left: 5px;">&nbsp;</td>
			</tr>
			<tr height="50px">
				<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_Reason.'</td>
				<td colspan="3" style="text-align: left;padding-left: 5px;">&nbsp;</td>
			</tr>
		</table>';
		return $kq;
	}
	function loadContent18($l_payment_request1,$l_content_payment,$l_beneficiaries,$l_branch,$l_name,$l_employeecode,$l_startwork,$l_phone,$l_day_event,$l_content_event,$l_place_event,$l_fileplus){
		$kq ='<table width="100%" border="1" cellspacing="0">
	<tr height="80px">
		<td style="font-weight: bold;"  align="center" valign="middle" bgcolor="#EEEEEE">'.$l_content_payment.'</td>
		<td style="font-weight: bold;font-size:20px;"  colspan="4"  align="center" ><input value="'.$l_payment_request1.'" readonly="readonly" style="font-weight: bold;width: 100%;height: 100%;font-size: 20px;text-align: center;border: none" width="100%" height="100%"></td>
	</tr>
	<tr height="50px">
		<td style="width: 10%;font-weight: bold;" rowspan="5" align="center" bgcolor="#EEEEEE">'.$l_beneficiaries.'</td>
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_branch.'</td>
		<td style="width: 30%;text-align: left;padding-left: 5px;">&nbsp;</td>
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_name.'</td>
		<td style="width: 30%;text-align: left;padding-left: 5px;" >&nbsp;</td>
	</tr>
	<tr height="50px">
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_employeecode.'</td>
		<td style="width: 30%;text-align: left;padding-left: 5px;" >&nbsp;</td>
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_startwork.'</td>
		<td style="width: 30%;text-align: left;padding-left: 5px;">&nbsp;</td>
	</tr>
	<tr height="50px">
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_phone.'</td>
		<td style="width: 30%;text-align: left;padding-left: 5px;" >&nbsp;</td>
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_day_event.'</td>
		<td style="width: 30%;text-align: left;padding-left: 5px;" >&nbsp;</td>
	</tr>
	<tr height="50px">
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_content_event.'</td>
		<td style="width: 40%;text-align: left;padding-left: 5px;" colspan="3">&nbsp;</td>
	</tr>
	<tr height="50px">
		<td style="width: 15%;font-weight: bold;" align="center" valign="middle" bgcolor="#EEEEEE">'.$l_place_event.'</td>
		<td style="width: 40%;text-align: left;padding-left: 5px;"colspan="3">&nbsp;</td>
	</tr>
	<tr height="50px">
		<td align="center" valign="middle" bgcolor="#EEEEEE" style="font-weight: bold;">'.$l_fileplus.'</td>
		<td colspan="4" style="text-align: left;padding-left: 5px;">&nbsp;</td>
	</tr>
	
</table>';
		return $kq;
	}
	function listDepartment($lang){
		$sql="select department_lang.IDDepartment,department_lang.DepartmentName from department_lang where LangID='".$lang."'";
		return $sql;
	}
	
	function listCustomer($danhsach,$sort){
		$sql="select ".$danhsach." from ac_customer".$sort;
		return $sql;
	}
	
	function listEmployee($lang){
		$sql="select department.IDDepartment, department_lang.DepartmentName from department, department_lang where department.IDDepartment = department_lang.IDDepartment and department_lang.LangID='".$lang."'";
		return $sql;
	}
	
	function listTax($lang){
		$sql="select ac_tax.TaxID,ac_tax_lang.TaxName from ac_tax,ac_tax_lang where ac_tax.TaxID = ac_tax_lang.TaxID and ac_tax_lang.LangID = '".$lang."'";
		return $sql;
	}
	
	function numberformat_to_basicString($strin){
		$kq="";
		$mang=explode(",", $strin);
		if(count($mang)>1){
			$kq=implode("", $mang);
		}else{
			$kq=$strin;
		}
		
		$mang=explode("-",$kq);
		if(count($mang)>1){
			$kq=implode("", $mang);
			$kq=-abs($kq);
		}
		return $kq;
	}
}

?>